#include <stdio.h>
#include <sys/sysctl.h>
#include <unistd.h>
#include <sys/types.h>

int main()
{
  int x = 100;

  pid_t id = fork();

  if (id == 0)
  {
    while (1)
    {

      printf("我是子进程,我的pid是%d,我的父进程是:%d,%d,%p\n", getpid(), getppid(), x, &x);
      sleep(1);
    }
  }
  else
  {
    while (1)
    {

      printf("我是父进程,我的pid是%d,我的父进程是%d,%d,%p\n", getpid(), getppid(), x, &x);
      x = 1234;
      sleep(1);
    }
  }

  return 0;
}
